<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class PerformanceItem extends Model
{
	use SoftDeletes;
	protected $fillable = ['performance_item_id', 'performance_assessment_id', 'title', 'type', 'weight', 'rating'];

	public static $typeMap	=	[
		0	=>	'工作态度',
		1	=>	'工作能力',
		2	=>	'月度业绩',
		3	=>	'管理体系',
		4	=>	'人才培养',
		5	=>	'人才流失',
	];

	public function performanceAssessment() {
		return $this->belongsTo(PerformanceAssessment::class);
	}

	public function performanceItem() {
		return $this->belongsTo(PerformanceItem::class);
	}
	
	public function performanceScores() {
		return $this->hasMany(PerformanceScore::class);
	}
}
